﻿using Prism.Mvvm;
using Prism.Navigation.Regions;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using ZuesControls.Models;
using ZuesControls.Mvvm;
using ZuesUI.Commons.MyPrism;
using ZuesUI.Models;
using ZuesUI.Views;
using static ZuesControls.Controls.ZSListBox;

namespace ZuesUI
{
    public class MainWindowViewModel : BindableBase
    {
        public static ImageSource TestIamge;
        public double Width;
        private readonly IRegionManager _regionManager;
        public double Height { get; }
        private TreeViewModel _selectedItem;
        private ObservableCollection<NavigateModel> _items = new ObservableCollection<NavigateModel>()
        {
            new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="布偶",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="橘猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="狸花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
               new NavigateModel(){Header="三花猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiekou")  },
                new NavigateModel(){Header="奶牛猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_Warning")  },
                 new NavigateModel(){Header="黑猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_jiafa")  },
             new NavigateModel(){Header="白猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_suibian")  },
              new NavigateModel(){Header="折耳猫",IconImage =(ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia")  },
        };
        public ObservableCollection<NavigateModel> Items
        {
            get { return _items; }
            set
            {
                SetProperty(ref _items, value);
            }
        }

        public ObservableCollection<ListItemModel> _gitems = new ObservableCollection<ListItemModel>()
        {
            new ListItemModel(){Gcode="橘猫是一种性格慵懒亲人、毛色温暖如阳光的猫咪，常被称为“橘猪”因其易胖体质而深受喜爱。",ShowType=ItemType.Gcode},
             new ListItemModel(){Gcode="三花猫：毛色斑斓、性格多变的猫界“小辣椒”，绝大多数为母猫",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="奶牛猫：黑白分明、活泼黏人，性格像“猫中哈士奇”。",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="狸花猫：体格健壮、适应力强，是最接地气的“中国田园猫”。”。",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="金渐层：金灿灿的“猫中贵族”，外表华丽，气质温和。\r\n\r\n”。",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="英短（英国短毛猫）：圆脸短腿、憨态可掬，性格稳重乖巧。”。",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="蓝猫（一般指英短蓝猫）：灰蓝毛色高贵冷艳，是英短中的经典代表。”。",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="布偶猫：大眼长毛、性格温顺，被称为“狗性猫”、“猫中仙女”",ShowType=ItemType.Gcode},
              new ListItemModel(){Gcode="起司猫：黄白相间的毛色可爱呆萌，常见于爱撒娇的橘白猫种。",ShowType=ItemType.Gcode},
        };

        private ObservableCollection<ListViewModel> _person = new ObservableCollection<ListViewModel>()
        {
            new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=17,IsSelected=false,Gender=GenderType.Men},
                new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=18,IsSelected=true,Gender=GenderType.Men},
                new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=19,IsSelected=false,Gender=GenderType.Women},
                new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=20,IsSelected=true,Gender=GenderType.Men},
                new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=21,IsSelected=false,Gender=GenderType.Men},
                new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=22,IsSelected=true,Gender=GenderType.Women},
                new ListViewModel{ LogDateTime = DateTime.Now,Name="发生了操作",Age=23,IsSelected=false,Gender=GenderType.Men}
        };

        private ObservableCollection<TreeListViewModel> _treeList = new ObservableCollection<TreeListViewModel>();

        private ObservableCollection<TabControlModel_Center> _tabList = new ObservableCollection<TabControlModel_Center>()
        {
            new TabControlModel_Center(){Title="树形列表",NavigationKey=new TreeListView()},
             new TabControlModel_Center(){Title="数据表格",NavigationKey=new DataGridView()},
             new TabControlModel_Center(){Title="参数折叠表格",NavigationKey = new DataGridExpanderView()}
        };
        public ObservableCollection<TabControlModel_Center> TabList
        {
            get { return _tabList; }
            set
            {
                SetProperty(ref _tabList,value);
            }
        }

        public ObservableCollection<TreeListViewModel> TreeList
        {
            get { return _treeList; }
            set
            {
                SetProperty(ref _treeList, value);
            }
        }

        public TreeListViewModel model = new TreeListViewModel() { Name = "父级", Address = "列1" };


        public ObservableCollection<ListItemModel> GItems
        {
            get { return _gitems; }
            set
            {
                SetProperty(ref _gitems, value);
            }
        }

        public ObservableCollection<ListViewModel> Person
        {
            get { return _person; }
            set
            {
                SetProperty(ref _person, value);
            }
        }


        private double _progressValue;
        public double ProgressValue
        {
            get => _progressValue;
            set
            {
                _progressValue = value;
                SetProperty(ref _progressValue,value); // 实现 INotifyPropertyChanged 接口
            }
        }

        private TabControlModel_Center _selectedTab ;
        public TabControlModel_Center SelectedTab
        {
            get => _selectedTab;
            set
            {
                SetProperty(ref _selectedTab, value);
               
            }
        }

        ITreeNode treemodel = new TreeViewModel() { Name = "猫1", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia") };
        ITreeNode treemode2 = new TreeViewModel() { Name = "猫2", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia") };
        ITreeNode treemode3 = new TreeViewModel() { Name = "猫3", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia") };
        ITreeNode treemode4 = new TreeViewModel() { Name = "猫4", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia") };
        ITreeNode treemode5 = new TreeViewModel() { Name = "猫5", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia") };
        ITreeNode treemode6 = new TreeViewModel() { Name = "猫6", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenjianjia") };
        private ObservableCollection<ITreeNode> treeViewModels = new ObservableCollection<ITreeNode>();
        public ObservableCollection<ITreeNode> TreeModels
        {
            get { return treeViewModels; }
            set
            {
                SetProperty(ref treeViewModels, value);
            }
        }

        private double _left;
        public double Left
        {
            get => _left;
            set
            {
                SetProperty(ref _left, value);
                this.UpdateShouldLeft();
            }
        }

        private void UpdateShouldLeft()
        {
            this.ShouldLeft = this.Left + this.IWidth;
        }

        private double _top;
        public double Top
        {
            get => _top;
            set
            {
                SetProperty(ref _top, value);
                this.UpdateShouldTop();
            }
        }

        private void UpdateShouldTop()
        {
            this.ShouldTop = this.Top;
        }

        private double _shouldleft;
        public double ShouldLeft
        {
            get => _shouldleft;
            set
            {
                SetProperty(ref _shouldleft, value);
            }
        }

        private double _iwidth;
        public double IWidth
        {
            get => _iwidth;
            set
            {
                SetProperty(ref _iwidth, value);
                this.UpdateShouldLeft();
            }
        }

        private double _iheight;
        public double IHeight
        {
            get => _iheight;
            set
            {
                SetProperty(ref _iheight, value);
                this.UpdateShouldTop();
            }
        }

        private double _shouldtop;
        public double ShouldTop
        {
            get => _shouldtop;
            set
            {
                SetProperty(ref _shouldtop, value);
            }
        }
        //初始化了读取数据的列表
        private ObservableCollection<InterfaceReciveDataModel> _dataitems = new ObservableCollection<InterfaceReciveDataModel>()
        {
            new InterfaceReciveDataModel(){Name = "第一层",Address = "DBD82.DBDW38",DbIndex = 82,DbDataIndex = 38},
            new InterfaceReciveDataModel(){Name = "第二层",Address = "DBD63.DBDW154",DbIndex = 63,DbDataIndex = 154},
            new InterfaceReciveDataModel(){Name = "第三层",Address = "DBD63.DBDW24",DbIndex = 63,DbDataIndex = 24},
            new InterfaceReciveDataModel(){Name = "第四层",Address = "DBD63.DBDW88",DbIndex = 63,DbDataIndex = 88},
            new InterfaceReciveDataModel(){Name = "第五层",Address = "DBD63.DBDW114",DbIndex = 63,DbDataIndex = 114},
            new InterfaceReciveDataModel(){Name = "Kp",Address = "DBD63.DBDW0",DbIndex = 63,DbDataIndex = 0},
            new InterfaceReciveDataModel(){Name = "Ki",Address = "DBD63.DBDW4",DbIndex = 63,DbDataIndex = 4},
            new InterfaceReciveDataModel(){Name = "Kd",Address = "DBD63.DBDW8",DbIndex = 63,DbDataIndex = 8},
              new InterfaceReciveDataModel(){Name = "温度",Address = "DBD82.DBDW38",DbIndex = 82,DbDataIndex = 38},
            new InterfaceReciveDataModel(){Name = "功率",Address = "DBD63.DBDW154",DbIndex = 63,DbDataIndex = 154},
            new InterfaceReciveDataModel(){Name = "目标温度",Address = "DBD63.DBDW24",DbIndex = 63,DbDataIndex = 24},
            new InterfaceReciveDataModel(){Name = "功率上限",Address = "DBD63.DBDW88",DbIndex = 63,DbDataIndex = 88},
            new InterfaceReciveDataModel(){Name = "积分隔离",Address = "DBD63.DBDW114",DbIndex = 63,DbDataIndex = 114},
            new InterfaceReciveDataModel(){Name = "Kp",Address = "DBD63.DBDW0",DbIndex = 63,DbDataIndex = 0},
            new InterfaceReciveDataModel(){Name = "Ki",Address = "DBD63.DBDW4",DbIndex = 63,DbDataIndex = 4},
            new InterfaceReciveDataModel(){Name = "Kd",Address = "DBD63.DBDW8",DbIndex = 63,DbDataIndex = 8},
              new InterfaceReciveDataModel(){Name = "温度",Address = "DBD82.DBDW38",DbIndex = 82,DbDataIndex = 38},
            new InterfaceReciveDataModel(){Name = "功率",Address = "DBD63.DBDW154",DbIndex = 63,DbDataIndex = 154},
            new InterfaceReciveDataModel(){Name = "目标温度",Address = "DBD63.DBDW24",DbIndex = 63,DbDataIndex = 24},
            new InterfaceReciveDataModel(){Name = "功率上限",Address = "DBD63.DBDW88",DbIndex = 63,DbDataIndex = 88},
            new InterfaceReciveDataModel(){Name = "积分隔离",Address = "DBD63.DBDW114",DbIndex = 63,DbDataIndex = 114},
            new InterfaceReciveDataModel(){Name = "Kp",Address = "DBD63.DBDW0",DbIndex = 63,DbDataIndex = 0},
            new InterfaceReciveDataModel(){Name = "Ki",Address = "DBD63.DBDW4",DbIndex = 63,DbDataIndex = 4},
            new InterfaceReciveDataModel(){Name = "Kd",Address = "DBD63.DBDW8",DbIndex = 63,DbDataIndex = 8},
              new InterfaceReciveDataModel(){Name = "温度",Address = "DBD82.DBDW38",DbIndex = 82,DbDataIndex = 38},
            new InterfaceReciveDataModel(){Name = "功率",Address = "DBD63.DBDW154",DbIndex = 63,DbDataIndex = 154},
            new InterfaceReciveDataModel(){Name = "目标温度",Address = "DBD63.DBDW24",DbIndex = 63,DbDataIndex = 24},
            new InterfaceReciveDataModel(){Name = "功率上限",Address = "DBD63.DBDW88",DbIndex = 63,DbDataIndex = 88},
            new InterfaceReciveDataModel(){Name = "积分隔离",Address = "DBD63.DBDW114",DbIndex = 63,DbDataIndex = 114},
            new InterfaceReciveDataModel(){Name = "Kp",Address = "DBD63.DBDW0",DbIndex = 63,DbDataIndex = 0},
            new InterfaceReciveDataModel(){Name = "Ki",Address = "DBD63.DBDW4",DbIndex = 63,DbDataIndex = 4},
            new InterfaceReciveDataModel(){Name = "Kd",Address = "DBD63.DBDW8",DbIndex = 63,DbDataIndex = 8},
        };
        public ObservableCollection<InterfaceReciveDataModel> DataItems
        {
            get { return _dataitems; }
            set
            {
                SetProperty(ref _dataitems, value);
            }
        }


        private ICommand _navigationCommand;
        public ICommand NavigationCommand
        {
            get
            {
                if (_navigationCommand == null)
                {
                    _navigationCommand = new RelayCommand<NavigateModel>(NavClick);
                }

                return _navigationCommand;
            }
        }

        public ICommand ItemDoubleClickCommand { get; }

        public ICommand BorderVisable { get; }

        public ICommand NotBorderVisable { get; }

        private void NavClick(NavigateModel model)
        {
            MessageBox.Show(model.Header);
        }

        public MainWindowViewModel(IRegionManager regionManager)
        {
            _regionManager = regionManager;
            ItemDoubleClickCommand = new RelayCommand<object>(OnItemDoubleClick);
            BorderVisable = new RelayCommand<object>(viscooamn);
            NotBorderVisable = new RelayCommand<object>(NotVis);
            TestIamge = (ImageSource)Application.Current.FindResource("Icon_jiafa");
            TreeModels.Add(treemodel);
            TreeModels.Add(treemode2);
            TreeModels.Add(treemode3);
            treemodel.Children.Add(treemode3);
            treemodel.Children.Add(treemode3);
            treemodel.Children.Add(treemode3);
            treemodel.Children.Add(treemode3);
            treemodel.Children.Add(new TreeViewModel() { Name = "金渐层", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemodel.Children.Add(new TreeViewModel() { Name = "银渐层", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemodel.Children.Add(new TreeViewModel() { Name = "英短蓝猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "布偶猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "暹罗猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "无毛猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "孟买猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "苏格兰折耳猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "挪威森林猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode2.Children.Add(new TreeViewModel() { Name = "缅因猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode3.Children.Add(treemode4);
            treemode4.Children.Add(treemode5);
            treemode5.Children.Add(treemode6);
            treemode3.Children.Add(new TreeViewModel() { Name = "俄罗斯蓝猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode3.Children.Add(new TreeViewModel() { Name = "加菲猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode3.Children.Add(new TreeViewModel() { Name = "波斯猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode3.Children.Add(new TreeViewModel() { Name = "美短", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            treemode3.Children.Add(new TreeViewModel() { Name = "起司猫", Icon = (ImageSource)System.Windows.Application.Current.FindResource("Icon_wenbenwendang") });
            model.Children.Add(new TreeListViewModel() { Name="子级",Address="子级列1"});
            model.Children.Add(new TreeListViewModel() { Name = "子级", Address = "子级列1" });
            model.Children.Add(new TreeListViewModel() { Name = "子级", Address = "子级列1" });
            model.Children.Add(new TreeListViewModel() { Name = "子级", Address = "子级列1" });
            model.Children.Add(new TreeListViewModel() { Name = "子级", Address = "子级列1" });
            model.Children.Add(new TreeListViewModel() { Name = "子级", Address = "子级列1" });
            model.Children.Add(new TreeListViewModel() { Name = "子级", Address = "子级列1" });
            TreeList = new ObservableCollection<TreeListViewModel>();
            TreeList.Add(model);
        }

        private void NotVis(object? obj)
        {

        }

        private void viscooamn(object t)
        {
            MessageBox.Show("");
        }

        private void OnItemDoubleClick(object? obj)
        {
            TreeViewModel treeViewModel = (TreeViewModel)obj;
            Console.WriteLine(treeViewModel.Name);
        }
    }
}
